package com.example.memorycardgame.model;

/**
 * 翻牌游戏的卡片模型（MVC中的Model）
 * 存储卡片的状态和数据
 */
public class Card {
    private int imageResId;  // 卡片正面图片资源ID
    private boolean isFlipped; // 是否已翻转（显示正面）
    private boolean isMatched; // 是否已匹配成功
    private int position;    // 卡片在网格中的位置

    public Card(int imageResId, int position) {
        this.imageResId = imageResId;
        this.position = position;
        this.isFlipped = false;
        this.isMatched = false;
    }

    // Getter和Setter
    public int getImageResId() {
        return imageResId;
    }

    public boolean isFlipped() {
        return isFlipped;
    }

    public void setFlipped(boolean flipped) {
        isFlipped = flipped;
    }

    public boolean isMatched() {
        return isMatched;
    }

    public void setMatched(boolean matched) {
        isMatched = matched;
    }

    public int getPosition() {
        return position;
    }

    // 翻转卡片（切换正反面）
    public void flip() {
        this.isFlipped = !this.isFlipped;
    }
}
}
